# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=diffstat
pkgver=1.61
pkgrel=1
pkgdesc="Display a histogram of diff changes"
arch=('i686' 'x86_64')
url="https://invisible-island.net/diffstat"
depends=('msys2-runtime')
groups=('base-devel')
license=('MIT')
source=("ftp://invisible-island.net/${pkgname}/${pkgname}-${pkgver}.tgz"
        diffstat-1.58-msys2.patch)
sha256sums=('25359e0c27183f997b36c9202583b5dc2df390c20e22a92606af4bf7856a55ee'
            'c4ec808391eea37809ba1f3eb043f01d52b486798db713cd6aef34d9f2a29162')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  patch -p1 -i ${srcdir}/diffstat-1.58-msys2.patch
}

build () {
  cd "${srcdir}/${pkgname}-${pkgver}"

  ./configure --build=${CHOST} \
    --prefix=/usr \
    --mandir=/usr/share/man
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make DESTDIR=${pkgdir}/ install
  install -Dm644 package/debian/copyright "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
